#!/bin/bash
#
# Copyright (c) 2012 - mDroidd (martijn.ruijzendaal@gmail.com)
#
# Please ask permission to use parts of this script
# I will be happy to give you!
#
# Credits go to: imagemagick, tommytomatoe, bash, internet
#

#
# Attention! Because the source section is device-specific, I made some
# Values here to make it easier for you to edit.
#
	function Source
	{

	if ! [ -d $ScriptDir/WORKING_DIR_$1 ]
	then
		mkdir $ScriptDir/WORKING_DIR_$1
		cd $ScriptDir/WORKING_DIR_$1
	else
		cd $ScriptDir/WORKING_DIR_$1
	fi
	if ! [ -d $ScriptDir/WORKING_DIR_$1/.repo ]
	then
	   if [ "$1" = "1" ]
	   then
	    GBSOURCE
	   fi
	   if [ "$1" = "2" ]
	   then
	    ICSSOURCE
	   fi
	   if [ "$1" = "3" ]
	   then
	    CMSOURCE
	   fi
	   if [ "$1" = "4" ]
	   then
	    OxGBSOURCE
	   fi
	   if [ "$1" = "5" ]
	   then
	    AOKPSOURCE
	   fi
	   if [ "$1" = "6" ]
	   then
	    OxICSSOURCE
	   fi
	   if [ "$1" = "7" ]
	   then
	    MiuiSOURCE
	   fi
	   if [ "$1" = "8" ]
	   then
	    CnaSource
	   fi
	fi
	repo sync
	}


	ICSSOURCE="Stock AOSP ICS Source"

# ^^ Is the value that will be displayed in menu

	function ICSSOURCE
	{
	repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1
	}

# ^^ That are the commands that will be executed when option is chosen
# Change the "repo init -u" to the one who ported the ROM to your device or stock

	GBSOURCE="Stock AOSP GB Source"

	function GBSOURCE
	{
	repo init -u https://android.googlesource.com/platform/manifest -b android-2.3.7_r1
	}

	CMSOURCE="Official CyanogenMod7 Source"

	function CMSOURCE
	{
	repo init -u git://github.com/CyanogenMod/android.git -b gingerbread
	}

	OxGBSOURCE="Oxygen source"

	function OxGBSOURCE
	{
	repo init -u git://github.com/oxygen-rom/android_manifest.git -b gingerbread
	}

	AOKPSOURCE="Android Open Kang SOURCE (ICS)"

	function AOKPSOURCE
	{
	repo init -u https://github.com/AOKP/platform_manifest.git -b master
	}

	OxICSSOURCE="[UNAVAILABLE]Oxygen ICS Source"

	function OxICSSOURCE
	{
	repo init -u
	}
	
	MIUISOURCE="[NEW] MIUI V4 ICS Source (Incomplete)"
	
	function MiuiSource
	{
	git clone git://github.com/miuiandroid/MIUI-ROM-V4.0--Ice-Cream-Sandwich-.git -b ics
	}

	CNASOURCE="[NEW] CodeName Android Source (ICS)"
	function CnaSource
	{
	repo init -u git://github.com/CNA/android_manifest.git -b mod-4.0.3
	}
#
# End of section
#

MyCommand=${0##*/}
Dir=${0%%/"$MyCommand"}
ScriptDir=$(cd $Dir && pwd)
PATH=~/bin:$PATH
ScriptVersion=$(head -1 $ScriptDir/changelog)
LogFile="$ScriptDir/log"

if [ "$1" = "" ]
then
	$ScriptDir/$MyCommand 0 2>> $LogFile
	exit
fi

if [ "$1" != "" ] && [ "$1" != "0" ]
then
	Command=$1
	$ScriptDir/$MyCommand 0 $Command 2>> $LogFile
	exit
fi

resize -s 31 80 >> /dev/null

clear


echo "---------------------------------------------------" >>$LogFile
date >> $LogFile
echo "v$ScriptVersion
---------------------------------------------------" >> $LogFile


function SplashScreen
{
	Animation
}


function Animation
{
clear
echo -e "\e[40;36m****************************************
*                                      *
*          Android toolbox             *
*            by mDroidd                *
*                                      *
****************************************\e[00;40m"
echo
echo
}

function StartScreen
{
clear
echo -e "\e[40;36m *******************************************************************************
 *                              Android Central                                *
 *                                by mDroidd                                   *
 *                                  v$ScriptVersion                                      *
 *******************************************************************************"
}


function Done
{
SplashScreen
echo
echo "Done :)"
echo
echo -n -e "\rContinueing in 3..."
sleep 1
echo -n -e "\rContinueing in 2..."
sleep 1
echo -n -e "\rContinueing in 1..."
sleep 1
}

function Open
{
	cd $ScriptDir
	if ! [ -f $ScriptDir/Utils.zip ]
	then
	 SplashScreen
	 echo
	 echo "ERROR, DELETED UTILS.ZIP?!"
	 sleep 3
	 SplashScreen
	 exit
	fi
	if ! [ -d $ScriptDir/Utils ]
	then
		./7za x -y ./Utils.zip > /dev/null
	fi
	chmod 755 $ScriptDir/Utils/*
}

function Close
{
	cd $ScriptDir
	SplashScreen
}

function ContinueTheme
{
	SplashScreen
	echo "OK, you placed something in it!"
	echo
	echo "Now choose the values you want to REMOVE:"
	echo "In a scale from 0-100 red,green,blue - WITHOUT SPACES!"
	echo "Example: purple = 25,50,0"
	echo
	echo "WARNING: It is recommended to start with a white theme."
	echo "Cause theming red images blue will make it purple instead!"
	echo
	echo -n "Please choose values RGB:  "
	read opt
	set $opt
	Values=$opt
	ThemeFiles=$(find -name *.png)
	typeset -i i=0
	for ThemeFile in $ThemeFiles
	do
		i=i+1
	done

	SplashScreen
	echo "Files found: $i"
	echo "Press ENTER to start theming..."
	read line
	
	mogrify -colorize $Values $ThemeFiles
	cd -
}

if ! [ -f ~/bin/AC ]
then
 SplashScreen
 echo "Do you want to generate a script"
 echo "So you can open this by only typing AC in terminal?"
 echo 
 echo "You will always see this when you choose for NO..."
 echo
 echo -n "Enter option (Y/n)  :  "
 read opt
 set $opt
 if ! [ "$opt" = "n" ] || [ "$opt" != "no" ]
 then
  SplashScreen
  if ! [ -d ~/bin ]
  then
	mkdir ~/bin
	PATH=~/bin:$PATH
  fi
echo "#!/bin/bash
$ScriptDir/$MyCommand" > ~/bin/AC
  chmod 755 ~/bin/AC
  $ScriptDir/$MyCommand
  exit
 fi
fi

if [[ $ScriptVersion > $(tail -1 $0) ]]
then
	echo $ScriptVersion >> $0
fi

while :
do
 echo -e "\e[40;36m"
 clear
 StartScreen
 echo
 echo -e " #####################"
 echo " #   Options:        #"
 echo -e " #####################\e[00;40m"
 echo "    1) Resize pictures"
 echo "    2) Prepare building from source"
 echo "    3) Build from source"
 echo "    4) Install Utilities"
 echo "    5) CopieFrom"
 echo "    6) Batch theme"
 echo "    7) Swich BuildSource-MODE"
 echo
 echo -e "\e[40;36m ####################"
 echo " #   Advanced:      #"
 echo -e " ####################\e[00;40m"
 echo "   w) Go to the XDA topic"
 echo "   i) Install the Android SDK!"
 echo "   j) Install the JDK!"
 echo "   c) Changelog"
 echo "   Cl) Clean the workspace"
 echo "   d) Donate"
 echo "   u) Update"
 echo "   x) Exit"
 echo 
 echo -n -e "\e[40;36m   Enter option: \e[00;40m"
 if [ "$2" != "" ]
 then
	opt=$2
 else
 	read opt
 fi

 if [ "$opt" != "1" ] && [ "$opt" != "2" ] && [ "$opt" != "3" ] && [ "$opt" != "4" ] && [ "$opt" != "5" ] && [ "$opt" != "6" ] && [ "$opt" != "w" ] && [ "$opt" != "i" ] && [ "$opt" != "c" ]  && [ "$opt" != "Cl" ] && [ "$opt" != "x" ] && [ "$opt" != "d" ] && [ "$opt" != "u" ] && [ "$opt" != "j" ] && [ "$opt" != "7" ]
 then
  SplashScreen
  echo " ERROR, INVALID OPTION!"
  sleep 3
 fi

 if [ "$opt" = "1" ] || [ "$opt" = "6" ]
 then
  mogrify -version
  if [ "$?" = "1" ]
  then
	sudo apt-get install imagemagick
  fi
 fi
if [ "$opt" = "1" ]
then
function CheckResize
{
  SplashScreen 
  echo "Place the images in AC/Resize (sub-directories supported!)"
  echo "Then give the image format (usually png)"
  echo "Last, give the resize percentage"
  echo
  echo "Placed something in it: [$Place]"
  echo "Gave image format:      [$Format]"
  echo "Gave resize percentage: [$Per]"
  echo
  echo "h) Home"
  echo "x) Exit"
  echo
  echo -n "Place images in ~/AndroidCentral/Resize..."
}
CheckResize
rm -rf ~/AndroidCentral/Resize
mkdir ~/AndroidCentral/Resize

while [ "$Perc" = "" ]
do

	sleep 1
	Empty=$(ls ~/AndroidCentral/Resize)
	if ! [ "$Empty" = "" ] && [ "$Place" = "" ]
	then
		Place="&"
		CheckResize
		echo
		echo -n "Now give the image format:  "
	fi
	if [ "$Place" = "&" ] && [ "$Format" = "" ]
	then
		read opt
		Ext=$opt
		Format="&"
		CheckResize
	fi
	if [ "$Format" = "&" ] && [ "$Perc" = "" ]
	then
		echo
		echo "Now give the resize percentage."
		echo "HDPI>MDPI=67%    HDPI>LDPI=43% XHDPI>HDPI=56%"
		read opt
		
		Perc=$opt
		CheckResize
	fi
	
	SrcDir=~/AndroidCentral/Resize
	DstDir=~/AndroidCentral/Resized
	
done

if ! [ -d $DstDir ]
then
	mkdir -p $DstDir
fi

clear
echo "We search for" \*\.$Ext from $SrcDir
echo "And the results will be put in:" $DstDir
sleep 1

typeset -i i=0
for Line in $(find $SrcDir -name \*.$Ext)
do
	FileName=${Line##*/}
	echo -n -e "\r$i  We are now converting" $Line 
	echo
		convert $Line -resize $Perc% $DstDir/$FileName 
	i=i+1	
done

if (( i == 0 ))
then
	echo
	echo
	echo "ERROR!" Files found: $i $i $i $i $i $i $i $i 
	echo
	echo
else
	echo
	echo
	echo Files converted: $i
	echo
	echo
fi
Done
fi
if [ "$opt" = "2" ]
then
set $opt
ConfFolder=$opt


 SplashScreen
 echo "Wich Ubuntu version are you?"
 echo "Options:"
 echo
 echo "1) Ubuntu 11.10"
 echo "2) Ubuntu 10.10"
 echo "3) Ubuntu 10.04 (recommended)(LTS also)"
 echo
 echo "4) I already configured this..."
 echo
 echo "o) Other (will exit)"
 echo "i) Info"
 echo
 echo -n "Enter option: "
 read opt
 set $opt
 FirstOption=$opt
 if [ "$opt" != "4" ] && [ "$opt" != "o" ] && [ "$opt" != "i" ]
 then
# All required packages will be installed
  clear
   echo "This is gonna take a while..."
   echo "In the meanwhile, you could thank me or donate?"
   sleep 3
  sudo add-apt-repository ppa:fkrull/deadsnakes
  sudo apt-get update
  sudo apt-get upgrade
  sudo apt-get install python2.5
  sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
  sudo apt-get update
  sudo apt-get install openjdk-7-jdk
  sudo apt-get update
  sudo apt-get upgrade
  sudo apt-get install git-core
  sudo apt-get install valgrind
  sudo apt-get install git-core gnupg flex bison gperf build-essential \
  zip curl zlib1g-dev libc6-dev lib64ncurses5-dev \
  x11proto-core-dev libx11-dev lib64readline-gplv2-dev lib64z1-dev \
  libgl1-mesa-dev g++-multilib tofrodos
  mkdir -p ~/bin
  mkdir -p ~/android/system
  curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  chmod a+x ~/bin/repo
  sudo echo '#Acer
SUBSYSTEM==usb, SYSFS{idVendor}==0502, MODE=0666

#ASUS
SUBSYSTEM==usb, SYSFS{idVendor}==0b05, MODE=0666

#Dell
SUBSYSTEM==usb, SYSFS{idVendor}==413c, MODE=0666

#Foxconn
SUBSYSTEM==usb, SYSFS{idVendor}==0489, MODE=0666

#Garmin-Asus
SUBSYSTEM==usb, SYSFS{idVendor}==091E, MODE=0666

#Google
SUBSYSTEM==usb, SYSFS{idVendor}==18d1, MODE=0666

#HTC
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"

#Huawei
SUBSYSTEM==usb, SYSFS{idVendor}==12d1, MODE=0666

#K-Touch
SUBSYSTEM==usb, SYSFS{idVendor}==24e3, MODE=0666

#KT Tech
SUBSYSTEM==usb, SYSFS{idVendor}==2116, MODE=0666

#Kyocera
SUBSYSTEM==usb, SYSFS{idVendor}==0482, MODE=0666

#Lenevo
SUBSYSTEM==usb, SYSFS{idVendor}==17EF, MODE=0666

#LG
SUBSYSTEM==usb, SYSFS{idVendor}==1004, MODE=0666

#Motorola
SUBSYSTEM==usb, SYSFS{idVendor}==22b8, MODE=0666

#NEC
SUBSYSTEM==usb, SYSFS{idVendor}==0409, MODE=0666

#Nook
SUBSYSTEM==usb, SYSFS{idVendor}==2080, MODE=0666

#Nvidia
SUBSYSTEM==usb, SYSFS{idVendor}==0955, MODE=0666

#OTGV
SUBSYSTEM==usb, SYSFS{idVendor}==2257, MODE=0666

#Pantech
SUBSYSTEM==usb, SYSFS{idVendor}==10A9, MODE=0666

#Philips
SUBSYSTEM==usb, SYSFS{idVendor}==0471, MODE=0666

#PMC-Sierra
SUBSYSTEM==usb, SYSFS{idVendor}==04da, MODE=0666

#Qualcomm
SUBSYSTEM==usb, SYSFS{idVendor}==05c6, MODE=0666

#SK Telesys
SUBSYSTEM==usb, SYSFS{idVendor}==1f53, MODE=0666

#Samsung
SUBSYSTEM==usb, SYSFS{idVendor}==04e8, MODE=0666

#Sharp
SUBSYSTEM==usb, SYSFS{idVendor}==04dd, MODE=0666

#Sony Ericsson
SUBSYSTEM==usb, SYSFS{idVendor}==0fce, MODE=0666

#Toshiba
SUBSYSTEM==usb, SYSFS{idVendor}==0930, MODE=0666

#ZTE
SUBSYSTEM==usb, SYSFS{idVendor}==19D2, MODE=0666' > /etc/udev/rules.d/51-android.rules
  sudo chmod a+r /etc/udev/rules.d/51-android.rules
  clear
  echo "OK, now the hardest part. Even that is not hard at all :)"
  echo "Press ENTER"
  echo '-----BEGIN PGP PUBLIC KEY BLOCK-----
    Version: GnuPG v1.4.2.2 (GNU/Linux)  
    mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV
    lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7
    8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD
    u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z
    wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq
    /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5
    jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4
    MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9
    b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv
    aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k
    cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX
    gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI
    2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl
    QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up
    hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk
    C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX
    LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+
    OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M
    pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s
    KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb
    N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA
    vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo
    G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ
    hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l
    EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=
    =Wi5D 
    -----END PGP PUBLIC KEY BLOCK-----' > ~/gpgimport
   gpg --import ~/gpgimport
   rm ~/gpgimport
  clear



  SplashScreen
  echo "And are you 32-bit or 64-bit?"
  echo "Options:"
  echo
  echo "1) 32-bit"
  echo "2) 64-bit"
  echo
  echo -n "Enter option: "
  read opt
  if [ "$opt" = "1" ]
  then
   clear
   echo "This is gonna take a while..."
   echo "In the meanwhile, you could thank me or donate?"
   sleep 3
   sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev \
libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown \
libxml2-utils xsltproc
  fi
  if [ "$opt" = "2" ]
  then
   clear
   echo "This is gonna take a while..."
   echo "In the meanwhile, you could thank me or donate?"
   sleep 3
   sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \
libxml2-utils xsltproc
  fi
  if [ "$FirstOption" = "1" ]
  then
   sudo apt-get install libx11-dev:i386
  fi
  if [ "$FirstOption" = "2" ]
  then
   sudo ln -s /usr/lib32/mesa/libGL.so.1 /usr/lib32/mesa/libGL.so
  fi
 fi
fi


if [ "$opt" = "x" ]
then
 SplashScreen
 echo -e "\e[00m"
 exit
fi
if [ "$opt" = "3" ]
then
  SplashScreen
  echo
  echo " What would you like to build from source?"
# HEhe, that's the place were the TOP values are used :)
  echo
  echo "  1) $GBSOURCE"
  echo "  2) $ICSSOURCE"
  echo "  3) $CMSOURCE"
  echo "  4) $OxGBSOURCE"
  echo "  5) $AOKPSOURCE"
  echo "  6) $OxICSSOURCE"
  echo "  7) $MIUISOURCE"
  echo "  8) $CNASOURCE"
  echo
  echo " MAKE SURE YOU HAVE AT LEAST 20GB OF FREE SPACE"
  echo
  echo
  echo -n "  Enter option:  "
  read opt
   SDir="$ScriptDir/WORKING_DIR_$opt"
   Dir=$SDir
   Source $opt

  echo "Done!"
fi
if [ "$opt" = "4" ]
then

	
 while :
 do
  SplashScreen
  echo
  echo "1) ADB"
  echo "2) AAPT"
  echo "3) 7z (terminal only)"
  echo "4) apktool"
  echo "5) optipng"
  echo "a) All!"
  echo
  echo "What would you like to install?"
  echo -n "Enter option:  "
  read opt
  
  if [ "$opt" = "1" ]
  then
   Open
   cd $ScriptDir/Utils
   cp cp $ScriptDir/Utils/adb ~/bin
   Close
   $ScriptDir/$MyCommand
   exit
  fi
  if [ "$opt" = "2" ]
  then
   Open
   cp $ScriptDir/Utils/aapt ~/bin
   Close
   $ScriptDir/$MyCommand
   exit
  fi
  if [ "$opt" = "3" ]
  then
   Open
   cp $ScriptDir/Utils/7za ~/bin
   Close
   $ScriptDir/$MyCommand
   exit
  fi
  if [ "$opt" = "4" ]
  then
   Open
   cp $ScriptDir/Utils/apktool.jar ~/bin
   cp $ScriptDir/Utils/apktool
   cp $ScriptDir/Utils/signapk.jar
   cp $ScriptDir/Utils/other ~/bin
   Close
   $ScriptDir/$MyCommand
  fi
  if [ "$opt" = "5" ]
  then
   Open
   cp $ScriptDir/Utils/optipng ~/bin
   Close
   $ScriptDir/$MyCommand
   exit
  fi
  if [ "$opt" = "a" ]
  then
   Open
   cp $ScriptDir/Utils/* ~/bin
   Close
   $ScriptDir/$MyCommand
   exit
  fi
  done
fi
if [ "$opt" = "c" ]
then
 SplashScreen
 gedit $ScriptDir/changelog
fi

if [ "$opt" = "w" ]
then
 SplashScreen
 xdg-open 'http://forum.xda-developers.com/showthread.php?t=1491689' 2> /dev/null
 clear
 SplashScreen
fi
if [ "$opt" = "i" ]
then
 SplashScreen
 Open
 cp $ScriptDir/Utils/sdk.tar ~
 cp $ScriptDir/7za ~
 cd
 ./7za x -y ~/sdk.tar
 rm ~/sdk.tar
 cd ~/android-sdk-linux/tools
 chmod 755 ./*
 ./android 2> /dev/null
 rm ~/7za
 Close
fi
if [ "$opt" = "5" ]
then
 SplashScreen
 echo
 echo "Usage: ToDir FromDir Ext"
 echo
 echo "Explanation: this tool lists the files inside a directory"
 echo "And copies that from another directory to that directory."
 echo
 echo "Example: you want to theme framework-res.apk with theme.apk"
 echo "So you enter framework-res as ToDir, and theme as FromDir"
 echo 
 echo -n "Enter values:  "
 read opt
 set $opt
 if (( $# != 3 ))
 then
  SplashScreen
  echo "ERROR! Usage: ToDir FromDir Ext"
  exit
 fi
 if ! [ -d $ToDir ] || ! [ -d $FromDir ]
 then
	SplashScreen
	echo "ERROR, $ToDir/$FromDir does not exist!" 
	exit 1
 fi
 ToDir=$(eval "echo $1")
 FromDir=$(eval "echo $2")
 Ext=$3
 typeset -i i=0
 for Line in $(ls $FwDir/*.$Ext)
 do 
	AbsFile=${Line##*/}
	echo "copy $SrScriptDir/$AbsFile to $FwDir"
	cp -f $SrScriptDir/$AbsFile $FwDir
	i=i+1
 done

	clear
	echo
	echo
	echo "Files copied: 00000$i"
	echo
	exit
fi
if [ "$opt" = "6" ]
then
	SplashScreen
	echo "Hey! This is new!"
	echo
	echo "Place the images you want to theme inside $ScriptDir/Theme"
	echo "When you did that, this will continue"
	if ! [ -d $ScriptDir/Theme ]
	then
		mkdir Theme
	fi
	while :
	do
	sleep 1
	cd $ScriptDir/Theme
	Check=$(ls)
	if [ "$Check" != "" ]
	then
		echo "You placed something in it :)"
		ContinueTheme
		$0
		exit
	fi
	done
fi
if [ "$opt" = "w" ]
then
 SplashScreen
 xdg-open 'http://forum.xda-developers.com/donatetome.php?u=4234443' 2> /dev/null
 clear
 SplashScreen
fi
if [ "$opt" = "u" ]
then
	$ScriptDir/ACI
fi
if [ "$opt" = "Cl" ]
then
	cd $ScriptDir
	rm -rf Theme Themed WORKING_DIR_* Utils
	rm ~/bin/AC ~/bin/central
fi
if [ "$opt" = "j" ]
then
	SplashScreen
	sudo apt-get install default-jdk
fi
if [ "$opt" = "7" ]
then
	cd $ScriptDir
	rm Source*~
	SplashScreen
	echo
	typeset -i i=1
	for Name in $(find -name \*Source*)
	do
		NameDisp=${Name##*"Source"}
		echo "$i)  $NameDisp"
		i=i+1
	done
	read opt
	typeset -i i=1
	for Source in $(find -name \*Source*)
	do
		Inc=${Source##*/}
		if [ "$i" = "$opt" ]
		then
			. $Inc
			echo "Included $Inc values..."
			Done
		fi
		i=i+1
	done
fi
opt=""
$ScriptDir/$MyCommand
done
done
#
#Additional INFORMATION for the ones who are clever enough to read this:
#
# Nice that you take your time and efforts to read this. Do you have any
# Suggestions for adding to this TOOL? Remember, you may want to use some of these
# Scripts, but ask me first. And DONATING would be nice! ;)
# (c) 2012 mDroidd @XDA (r) All rights reserved
0.09
